package com.len.mapper;

import com.len.base.BaseMapper;
import com.len.entity.SpGoods;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface SpGoodsMapper extends BaseMapper<SpGoods,String> {

    @Select("update sp_goods set TB_GOODS_NUM =#{goodsNum} where ID=#{id}")
    void changeNum(String goodsNum,String id);

    @Select("select TB_GOODS_NAME,TB_GOODS_PRICE,TB_GOODS_NUM,ID,TB_GOODSTO,TB_GOODS_PATH from  sp_goods where TB_GOODS_DATE =#{date} and TB_GOODS_STATE=#{type} and TB_GOODS_STATUS =1")
    List<Map> getProductByType(String date, String type);

    @Select("select * from sp_goods  where ID =#{id}   ")
    SpGoods selectId(String id);
    @Update("Update sp_goods set TB_GOODS_PRICE = #{price}  where ID =#{id}   ")
    boolean updatePrice(double price, String id);
    @Update("Update sp_goods set TB_GOODSTO = #{user}  where ID =#{id}   ")
    boolean updateto(String  user, String id);
    @Select("select * from sp_goods  where ID =#{id}   ")
    Map selectIds(String id);
    int insert1(SpGoods spGoods);
}
